﻿Imports Microsoft.WindowsAPICodePack.Taskbar
Imports Microsoft.WindowsAPICodePack.Shell

Public Class FrmMain
    Dim BolCancel As Boolean = False
   
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Try
            'Add an Icon above the taskbar
            Dim ID As StockIconIdentifier = StockIconIdentifier.MediaDvd
            Dim Size As StockIconSize = StockIconSize.ShellSize
            Dim SelectedIcon As New Microsoft.WindowsAPICodePack.Shell.StockIcon(ID, Size, False, False)
            TaskbarManager.Instance.SetOverlayIcon(SelectedIcon.Icon, "Backing up...")

            'Add progressbar to the icon (Progressvalue is not needed for indeterminate)
            TaskbarManager.Instance.SetProgressValue(50, 100)
            TaskbarManager.Instance.SetProgressState(TaskbarProgressBarState.Indeterminate)
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try

        PrgOverallFiles.Style = ProgressBarStyle.Marquee
    End Sub

    Private Sub CmdCancel_Click(sender As Object, e As EventArgs) Handles CmdCancel.Click
        BolCancel = True
    End Sub
End Class
